// 这里是user文件夹
const userRouter = require("./user");
const postRouter = require("./post");
const commentRouter = require("./comment");

const express = require("express");

const router = express.Router();

// http://主机名
router.get("/",(req,res) =>{
    // res.send("<h1>主页</h1>");
    // 渲染render，从设置的模板文件夹来找，这个index是views中的
    res.render("index",{title: "首页"});
})

router.get("/login",(req,res) =>{
    res.render("login",{title: "登录界面"});
})

router.get("/post",(req,res) =>{
    res.render("post",{title: "文章"});
})


module.exports = function(app){
    app.use("/",router);
    app.use("/user",userRouter);
    app.use("/post",postRouter);
    app.use("/comment",commentRouter);
}